package com.kubepartners.impactmodel.model;

import org.jgrapht.graph.DefaultEdge;

public class Edge extends DefaultEdge {
	private static final long serialVersionUID = 9127732381193115480L;
	private String id;
	private double weight;
	private double threshold;
	private Node startNode;
	private Node endNode;
	
	//properties that implement error state for the Node;
	private boolean weight_error =false;
	private boolean threshold_error = false;
	private boolean alias =false;

	
	public Edge(String id){
		this.id = id;
	}
	
	public Edge(String id, double weight, double threshold, Node start_node, Node end_node) {
		this.id = id;
		this.weight = weight;
		this.threshold = threshold;
		this.startNode = start_node;
		this.endNode = end_node;
	}
	
	public Edge(String id, Node start_node, Node end_node) {
		this.id = id;
		this.startNode = start_node;
		this.endNode = end_node;
	}

	public void setThreshold(double thrs){
		this.threshold = thrs;
	}
	
	public void setWeight(double w){
		this.weight = w;
	}
	
	public void setStartNode(Node node){
		this.startNode = node;
	}
	
	public void setEndNode(Node node){
		this.endNode = node;
	}
	
	public double getThreshold(){
		return Graph.round(this.threshold);
	}
	
	public double getWeight(){
		return Graph.round(this.weight);
	}
	
	public Node getStartNode(){
		return this.startNode;
	}
	
	public Node getEndNode(){
		return this.endNode;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}
	
	public String toString() {
		return "Edge:" + id + " is connected from " + startNode + " to " + endNode;
	}

	public boolean isWeight_error() {
		return weight_error;
	}

	public void setWeight_error(boolean weight_error) {
		this.weight_error = weight_error;
	}

	public boolean isThreshold_error() {
		return threshold_error;
	}

	public void setThreshold_error(boolean threshold_error) {
		this.threshold_error = threshold_error;
	}

	public boolean isAlias() {
		return alias;
	}

	public void setAlias(boolean alias) {
		this.alias = alias;
	}


}
